﻿using System.Configuration;
using mmoss.orm;

/// <summary>
/// Summary description for dbconn
/// </summary>
/// 
public class dbconn
{
	public dbconn()
	{
    }
    public static short enterpriseID
    {
        get
        {
            return 1;
        }
    }
    public static posDataContext LinqContext
    {
        get
        {
            if (_LinqContext != null)
            {
                return _LinqContext;
            }
            _LinqContext = new posDataContext(ConnectionString);
            return _LinqContext;
        }
    }

    private static posDataContext _LinqContext = null;
    protected static int m_intReturnValue;
    protected static string m_strConnectionServer;
    protected static string m_strConnectionString;
    protected static string m_strMessage;

    public static string ConnectionServer
    {//start property connection string
        //Property Get()
        get
        {//start get
            //Establish if a connection string already exists.
            if (m_strConnectionServer == null)
            {
                //No, there is no current connection string so retrieve the connection
                //string from the web.config file.
                //ConnectionString = ConfigurationSettings.AppSettings("ConnectionString");
                return ConnectionServer = ConfigurationManager.AppSettings["mmossconn"].ToString(); //ConfigurationSettings.AppSettings.Get("rexhubconn");
            }
            else
            {
                //Yes, a connection string has been previously set so return that string.
                return ConnectionServer = m_strConnectionServer;
            }
        }//end get
        //Property Set()
        set
        {
            //Retrieve the value of the passed connection string.
            m_strConnectionServer = value;
        }
    }

    public static string ConnectionString
    {//start property connection string
        //Property Get()
        get
        {//start get
            //Establish if a connection string already exists.
            if (m_strConnectionString == null)
            {
                //No, there is no current connection string so retrieve the connection
                //string from the web.config file.
                //ConnectionString = ConfigurationSettings.AppSettings("ConnectionString");
                return ConnectionString = ConfigurationManager.ConnectionStrings["mmossconn"].ToString(); //ConfigurationManager.AppSettings.Get("rexhubconn").ToString();
            }
            else
            {
                //Yes, a connection string has been previously set so return that string.
                return ConnectionString = m_strConnectionString;
            }
        }//end get
        //Property Set()
        set
        {
            //Retrieve the value of the passed connection string.
            m_strConnectionString = value;
        }
    }

    public static string Message
    {
        get
        {
            return m_strMessage;
        }
        set
        {
            m_strMessage = value;
        }
    }
}